package com.message.tcp.ip.ui.member.dialog;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;

import com.message.tcp.ip.ui.member.action.MemberAddAction;

import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class MemberAddDialog extends JDialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3487298485819920745L;
	private final JPanel contentPanel = new JPanel();
	private JTextField iin;
	private JTextField memberId;
	private JTextField name;
	private JTextField location;
	public MemberAddDialog(MemberTable table) {
		setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\phoud\\Pictures\\document-console-icon.png"));
		setTitle("Member Registration");
		setBounds(100, 100, 403, 227);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		GridBagLayout gbl_contentPanel = new GridBagLayout();
		gbl_contentPanel.columnWidths = new int[]{32, 52, 161, 26, 48, 0};
		gbl_contentPanel.rowHeights = new int[]{20, 20, 20, 20, 0};
		gbl_contentPanel.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_contentPanel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		contentPanel.setLayout(gbl_contentPanel);
		{
			JLabel lblNewLabel = new JLabel("IIN");
			GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
			gbc_lblNewLabel.anchor = GridBagConstraints.EAST;
			gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
			gbc_lblNewLabel.gridx = 1;
			gbc_lblNewLabel.gridy = 0;
			contentPanel.add(lblNewLabel, gbc_lblNewLabel);
		}
		{
			iin = new JTextField();
			GridBagConstraints gbc_iin = new GridBagConstraints();
			gbc_iin.anchor = GridBagConstraints.NORTH;
			gbc_iin.fill = GridBagConstraints.HORIZONTAL;
			gbc_iin.insets = new Insets(0, 0, 5, 5);
			gbc_iin.gridx = 2;
			gbc_iin.gridy = 0;
			contentPanel.add(iin, gbc_iin);
			iin.setColumns(10);
		}
		{
			JLabel lblRequired = new JLabel("(required)");
			GridBagConstraints gbc_lblRequired = new GridBagConstraints();
			gbc_lblRequired.anchor = GridBagConstraints.WEST;
			gbc_lblRequired.insets = new Insets(0, 0, 5, 0);
			gbc_lblRequired.gridx = 4;
			gbc_lblRequired.gridy = 0;
			contentPanel.add(lblRequired, gbc_lblRequired);
		}
		{
			JLabel lblNewLabel_1 = new JLabel("MEMER ID");
			GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
			gbc_lblNewLabel_1.anchor = GridBagConstraints.EAST;
			gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5);
			gbc_lblNewLabel_1.gridx = 1;
			gbc_lblNewLabel_1.gridy = 1;
			contentPanel.add(lblNewLabel_1, gbc_lblNewLabel_1);
		}
		{
			memberId = new JTextField();
			GridBagConstraints gbc_memberId = new GridBagConstraints();
			gbc_memberId.anchor = GridBagConstraints.NORTH;
			gbc_memberId.fill = GridBagConstraints.HORIZONTAL;
			gbc_memberId.insets = new Insets(0, 0, 5, 5);
			gbc_memberId.gridx = 2;
			gbc_memberId.gridy = 1;
			contentPanel.add(memberId, gbc_memberId);
			memberId.setColumns(10);
		}
		{
			JLabel lblrequired = new JLabel("(required)");
			GridBagConstraints gbc_lblrequired = new GridBagConstraints();
			gbc_lblrequired.anchor = GridBagConstraints.WEST;
			gbc_lblrequired.insets = new Insets(0, 0, 5, 0);
			gbc_lblrequired.gridx = 4;
			gbc_lblrequired.gridy = 1;
			contentPanel.add(lblrequired, gbc_lblrequired);
		}
		{
			JLabel lblNewLabel_2 = new JLabel("NAME");
			GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints();
			gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST;
			gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5);
			gbc_lblNewLabel_2.gridx = 1;
			gbc_lblNewLabel_2.gridy = 2;
			contentPanel.add(lblNewLabel_2, gbc_lblNewLabel_2);
		}
		{
			name = new JTextField();
			GridBagConstraints gbc_name = new GridBagConstraints();
			gbc_name.anchor = GridBagConstraints.NORTH;
			gbc_name.fill = GridBagConstraints.HORIZONTAL;
			gbc_name.insets = new Insets(0, 0, 5, 5);
			gbc_name.gridx = 2;
			gbc_name.gridy = 2;
			contentPanel.add(name, gbc_name);
			name.setColumns(10);
		}
		{
			JLabel lblrequired_1 = new JLabel("(required)");
			GridBagConstraints gbc_lblrequired_1 = new GridBagConstraints();
			gbc_lblrequired_1.anchor = GridBagConstraints.WEST;
			gbc_lblrequired_1.insets = new Insets(0, 0, 5, 0);
			gbc_lblrequired_1.gridx = 4;
			gbc_lblrequired_1.gridy = 2;
			contentPanel.add(lblrequired_1, gbc_lblrequired_1);
		}
		{
			JLabel lblNewLabel_3 = new JLabel("LOCATION");
			GridBagConstraints gbc_lblNewLabel_3 = new GridBagConstraints();
			gbc_lblNewLabel_3.anchor = GridBagConstraints.WEST;
			gbc_lblNewLabel_3.insets = new Insets(0, 0, 0, 5);
			gbc_lblNewLabel_3.gridx = 1;
			gbc_lblNewLabel_3.gridy = 3;
			contentPanel.add(lblNewLabel_3, gbc_lblNewLabel_3);
		}
		{
			location = new JTextField();
			GridBagConstraints gbc_location = new GridBagConstraints();
			gbc_location.anchor = GridBagConstraints.NORTH;
			gbc_location.fill = GridBagConstraints.HORIZONTAL;
			gbc_location.insets = new Insets(0, 0, 0, 5);
			gbc_location.gridx = 2;
			gbc_location.gridy = 3;
			contentPanel.add(location, gbc_location);
			location.setColumns(10);
		}
		{
			JLabel lblrequired_2 = new JLabel("(required)");
			GridBagConstraints gbc_lblrequired_2 = new GridBagConstraints();
			gbc_lblrequired_2.anchor = GridBagConstraints.WEST;
			gbc_lblrequired_2.gridx = 4;
			gbc_lblrequired_2.gridy = 3;
			contentPanel.add(lblrequired_2, gbc_lblrequired_2);
		}
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton okButton = new JButton("OK");
				MemberAddAction memberAddAction = new MemberAddAction(memberId,iin,name,location,table,this);
				okButton.addActionListener(memberAddAction);
				okButton.setActionCommand("OK");
				buttonPane.add(okButton);
				getRootPane().setDefaultButton(okButton);
			}
			{
				JButton cancelButton = new JButton("Cancel");
				cancelButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						dispose();
					}
				});
				cancelButton.setActionCommand("Cancel");
				buttonPane.add(cancelButton);
			}
		}
		{
			JPanel panel = new JPanel();
			getContentPane().add(panel, BorderLayout.NORTH);
			{
				JLabel lblNewLabel_4 = new JLabel("Member Add Form");
				lblNewLabel_4.setFont(lblNewLabel_4.getFont().deriveFont(lblNewLabel_4.getFont().getStyle() | Font.BOLD));
				panel.add(lblNewLabel_4);
			}
		}
	}

}
